package org.jamailia.core.ssl;

import org.apache.log4j.Logger;

import javax.net.ssl.X509TrustManager;
import java.security.cert.X509Certificate;


/**
 * TrustAlwaysManager - not secure, but simple. As described in JavaMail API 1.4.1
 */
public class TrustAlwaysManager implements X509TrustManager {

    private static final Logger LOG = Logger.getLogger(TrustAlwaysManager.class);

    public void checkClientTrusted( X509Certificate[] cert, String authType ) {
        if (LOG.isTraceEnabled()) {
            LOG.trace("TrustAlwaysManager - [checkClientTrusted]: check requested, authType " + authType);
        }
    }

    public void checkServerTrusted( X509Certificate[] cert, String authType ) {
        if (LOG.isTraceEnabled()) {
            LOG.trace("TrustAlwaysManager - [checkServerTrusted]: check requested, authType " + authType);
        }
    }

    public X509Certificate[] getAcceptedIssuers() {
        if (LOG.isTraceEnabled()) {
            LOG.trace("TrustAlwaysManager - [getAcceptedIssuers]: delivering empty certificat array ");
        }
        return new X509Certificate[0];
    }
}
